-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix underflow in manual_split_once
lint
#8250
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @giraffate (or someone else) soon. Please see the contribution instructions for more information. |
(I'm the friend) This was introduced when the lint was added and subsequently started affecting nightlies with |
A better fix would be to change the first if to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Can you add a test?
Definitely, I wasn't sure where to put it though. Is it supposed to be a full UI test of the lint (I couldn't find one for this lint), or is there already one and I should just add the failing code from the description, or is there some place where you'd put regression tests for bugs like this? |
You can write code from description and put a test here: https://github.com/rust-lang/rust-clippy/blob/master/tests/ui/manual_split_once.rs The right name of the lint is |
check_manual_split_once
lintmanual_split_once
lint
Since this is a ICE fix, we usually put those in |
Sorry for the delay, I've added the test to |
@bors r+ It looks good, thanks! |
📌 Commit 23fd95a has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Hi, a friend found clippy started crashing on a suspiciously large allocation of
u64::MAX
memory on their code.The mostly minimized repro is:
The underflow happens in this case on line 57 of the patch but I've changed the other substraction to saturating as well since it could potentially cause the same issue.
I'm not sure where to put a regression test, or if it's even worth for such a thing.
Aside, has it been considered before to build clippy with overflow checks enabled?
changelog: fix ICE of underflow in
manual_split_once
lint